popover: Add the .background style class
authorMatthias Clasen <mclasen@redhat.com>
Wed, 4 Nov 2015 17:01:26 +0000 (12:01 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 4 Nov 2015 17:05:03 +0000 (12:05 -0500)
This style class indicates that something _requires_ a background,
which is clearly the case for popovers.

gtk/gtkpopover.c

index 8ead636d57fca3f25126698f2cd21b8e6a1d7222..7050e6803d1d6c71d47ec05aa05467a1716499ae 100644 (file)
@@ -73,9 +73,9 @@
  *
  * # CSS nodes
  *
- * GtkPopover has a single css node called popover and gets the
- * .menu style class if it is menu-like (e.g. #GtkPopoverMenu or
- * created using gtk_popover_new_from_model().
+ * GtkPopover has a single css node called popover It always gets the
+ * .background style class and it gets the .menu style class if it is
+ * menu-like (e.g. #GtkPopoverMenu or created using gtk_popover_new_from_model().
  *
  * Particular uses of GtkPopover, such as touch selection popups
  * or magnifiers in #GtkEntry or #GtkTextView get style classes
@@ -191,6 +191,7 @@ static void
 gtk_popover_init (GtkPopover *popover)
 {
   GtkWidget *widget;
+  GtkStyleContext *context;
 
   widget = GTK_WIDGET (popover);
   gtk_widget_set_has_window (widget, TRUE);
@@ -198,6 +199,9 @@ gtk_popover_init (GtkPopover *popover)
   popover->priv->modal = TRUE;
   popover->priv->tick_id = 0;
   popover->priv->transitions_enabled = TRUE;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (popover));
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_BACKGROUND);
 }
 
 static void